package com.stb.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.RootPanel;
import com.stb.client.menu.ActivateUserCommand;
import com.stb.client.menu.MainMenu;

public class Yaggle implements EntryPoint, ValueChangeHandler<String> {
	
	@Override
	public void onModuleLoad() {
		RootPanel.get().add(new MainMenu());
		DOM.setInnerHTML(RootPanel.get("Loading-Message").getElement(), "");
		
	    History.addValueChangeHandler(this);
	    History.fireCurrentHistoryState();
	}

	@Override
	public void onValueChange(ValueChangeEvent<String> event) {
		String eventData = event.getValue();
		if (eventData.startsWith("activate")) {
			new ActivateUserCommand(eventData).execute();
		}
	}
}
